package cn.com.lms.business.examRewrite.enums;

/**
 * 题型 1-单选题 2-多选题 3判断题 4填空题 5问答题
 */
public enum  SubjectTypeEnum {
    SINGLE_OPTION("单选题",Short.valueOf("1")),

    MULTIPLE_OPTION("多选题",Short.valueOf("2")),
    JUDGE("判断题",Short.valueOf("3")),
    FILL("填空题",Short.valueOf("4")),
    EXPLAIN("问答题",Short.valueOf("5"));
    private String name;//名称

    private Short value;//值

    /**
     * 通过type获取Msg
     *
     * @param type
     * @return
     * @Description:
     */
    public static String getEnumMsgByType(String type) {
        for (SubjectTypeEnum e : SubjectTypeEnum.values()) {
            if (e.toString().equals(type)) {
                return e.name;
            }
        }
        return "";
    }

    public static Short getEnumValueByType(String type) {
        for (SubjectTypeEnum e : SubjectTypeEnum.values()) {
            if (e.toString().equals(type)) {
                return e.value;
            }
        }
        return 0;
    }
    private SubjectTypeEnum(String name,Short value) {
        this.name = name;
        this.value = value;
    }


    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    public Short getValue() {
        return value;
    }
    public void setValue(Short value) {
        this.value = value;
    }
}
